import request from '@/utils/request'

// 获取一级分类数据的接口的函数
// /admin/product / getCategory1
export const reqCategory1List = () => request.get('/admin/product/getCategory1')


// 获取二级分类数据的接口的函数
export const reqCategory2List = (category1Id) => request.get(`admin/product/getCategory2/${category1Id}`)

// 获取三级分类数据的接口的函数
export const reqCategory3List = (category2Id) => request.get(`admin/product/getCategory3/${category2Id}`)

// 获取平台属性数据的接口的函数
// api: admin/product/attrInfoList/2/13/61   method: get
export const reqAttrInfoList = (category1Id, category2Id, category3Id) => {
    return request.get(`admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`)
}

// 增加|修改平台属性的接口的函数
// api: /admin/product/saveAttrInfo  method: post
export const reqSaveAttrInfo = (data) => {
    return request({
        url: '/admin/product/saveAttrInfo',
        method: 'post',
        data
    })
}

// 删除平台属性的接口的函数
export const reqDeleteAttr = (attrId) => {
    return request({
        url: `/admin/product/deleteAttr/${attrId}`,
        method: 'delete'
    })
}